// pages/order-result/order-result.js
var app = getApp();
var selectPayResultUrl = "userOrderApi/selectPayResult";

Page({
  data: {
  success:true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    console.log(options)
    wx.request({

      url: app.globalData.requestUrl + selectPayResultUrl,
      header: {
        'content-type': 'application/json'
      },
      method: 'POST',
      data: {//这里写你要请求的参数
        userId: app.globalData.userId,
        deviceType: 'C142001',
        orderNo: options.batchNo,
        orderNoType: 2,
        amount: options.totalMoney,
        payType: options.payType,
        'from': "C191001",
        signType: 'MD5',
      },

      success: (res) => {
        console.log(res)

        if(res.data.status == 1){
          that.setData({
            success: true
         })
        }else(

          that.setData({
            success: false
          })

        )
      }

    })
  },
  toIndex: function () {
    wx.switchTab({
      url: "/pages/index/index"
    });
  },
  toOrderDetails: function () {
    wx.navigateTo({
      url: "/pages/order-details/order-details"
    });
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function (e) {

  },

})